
import request from '@/utils/request2.js' 
 
export function login(data){ // 登录
	return request({
	    url: '/admin/login?Phone='+data.phoneNumber+'&password='+data.password,
		method: 'post'
		// data: JSON.stringify(data)
	 })
}
//注册接口

export function regis(data,code){ 
	
	return request({
		url:'/admin/register?code='+code + '&phone='+data.phone +'&password='+ data.password +'&password2=' + data.password2,
		method: 'post'
		
	 })
	// console.log(code,data)
}
//注册验证码接口
export function getCode(phone){ 
	return request({
		url:'/admin/sendVerificationCode?phone='+phone,
		method: 'post'
		
	 })
	// console.log(code,data)
}
//找回密码接口
export function RetrievePwd(data,code){ 
	// console.log(code)
	return request({
		url:'/admin/retrievePassword?phone='+data.phoneNumber+'&password='+data.password+'&code='+code.toString(),
		method: 'post'
		// data: JSON.stringify(data)
	 })
	// console.log(code,data)
}
//找回密码验证码接口
export function getPwdCode(phone){ 
	return request({
		url:'/admin/sendLoginVerificationCode?phone='+phone,
		method: 'post'
		
	 })
	// console.log(code,data)
}
//首页接口
export function HomeInfor(){ 
	return request({
		url:'/order/getAdminData',
		method: 'get'
		
		
	 })
	// console.log(code,data)
}

//查询所有确认订单
export function getConfirm(){
	return request({
		url:'/order/getConfirm',
		method:'get'
	})
}
//查询所有完成订单
export function  getComplete(){
	return request({
		url:'/order/getComplete',
		method:'get'
	})
}
//查询所有预约订单
export function  getAppointment(){
	return request({
		url:'/order/getAppointment',
		method:'get'
	})
}

//查询对应日期的预约订单
export function getDateAppointment(data){
	return request({
		url:'/order/getDateAppointment?date='+data,
		method:'get'
	})
}

//查询对应日期的确认订单
export function getDateConfirm(data){
	return request({
		url:'/order/getDateConfirm?date='+data,
		method:'get'
	})
}
//查询对应日期的完成订单
export function getDateComplete(data){
	return request({
		url:'/order/getDateComplete?date='+data,
		method:'get'
	})
}
//查询指定日期的预约信息
export function getAppointDateMessage(data){
	return request({
		url:"/AppointmentTime/getAppointDateMessage?date="+data,
		method:'get'
		
	})
}
//查询时间管理相关信息
export function getTimeManagement(){
	return request({
		url:'/TimeManagement/getTimeManagement',
		method:'get'
	})
}

//设置时间管理
export function addCmsTimeManagement(data){
	return request({
		url:'/TimeManagement/addCmsTimeManagement',
		method:'post',
		data:JSON.stringify(data)
		
	})
	
}
//关闭某个时间的预约
export function setTodayTimeMessageClose(data){
	return request({
		url:'/AppointmentTime/setTodayTimeMessageClose?date='+data.all +'&time='+data.time,
		method:'put'
	})
}
//将某个关闭的预约开启   变为可预约状态
export function setTodayTimeMessageStart(data){
	return request({
		url:'/AppointmentTime/setTodayTimeMessageStart?date='+data.all +'&time='+data.time,
		method:'put'
	})
}

//查询门店服务
export function getStore(){
	return request({
		url:'/ServiceAll/getStore',
		method:'get',
		dataType:'text'
	})
}
//门店服务删除
export function removeService(index){
	return request({
		url:"/ServiceAll/removeService?id="+index,
		method:'DELETE'
		
	})
}
//门店服务下架
export function closeService(index){
	return request({
		url:'//ServiceAll/closeService?id='+index,
		method:'put'
	})
}
//查询上门服务
export function getHomeService(){
	return request({
		url:'/ServiceAll/getHomeService',
		method:'get',
		dataType:'text'
	})
}
//查询已经下架
export function getOffShelf(){
	return request({
		url:'/ServiceAll/getOffShelf',
		method:'get',
		dataType:'text'
	})
}
//已下架中 上架接口
export function putOnTheShelf(index){
	return request({
		url:'/ServiceAll/putOnTheShelf?id='+index,
		method:'put'
	})
}
// 编辑 数据回显 (发布新服务也是这一个)
export function getServiceInfo(data){
	return request({
		url:'/ServiceAll/getServiceInfo?id='+data,
		method:'get',
		dataType:'text'
	})
}
//图片上传
export function addPhoto(data){
	  const token = uni.getStorageSync('token');
	return request({
		url:'/ServiceAll/addPhoto',
		method:'POST',
		header:{
			token
		},
		data:data
		
		
	})
}
// 上架销售
export function onSale(datas){
	return request({
		url:'/ServiceAll/onSale',
		method:'post',
		data:JSON.stringify(datas)
		
	})
	
}
//上架仓库
export function addWarehouse(datas){
	return request({
		url:'/ServiceAll/addWarehouse',
		method:'post',
		data:JSON.stringify(datas)
		
	})
}

//获取店铺信息
export function ShopInfor(){
	return request({
		url:'/shop/addOrSelect',
		method:'get'
	})
}